const express = require('express')
const logger = require('morgan')                    //引入日志
const body = require('body-parser')                 //引入post请求的body解析格式
const favicon = require('serve-favicon')            //引入浏览器小Icon
const session = require('express-session')          //引入session
const cookieParser = require('cookie-parser')       //引入cookie

const UploadImgRouter = require('./Routers/UploadImgRouter')
const SendCodeRouter = require('./Routers/SendCodeRouter')

const myApp = express()

myApp.use(logger('dev'))                    //服务器使用日志

myApp.use(session({
    name: 'lk',
    secret: '1234',
    cookie: {maxAge:600000},
    saveUninitialized: true,
    resave: true,
    rolling: true,
}))

myApp.use(body.urlencoded({extended: false}))
myApp.use(body.urlencoded({limit: '50mb',extended: true}))
myApp.use(body.json({limit:'50mb'}))

myApp.use(UploadImgRouter)
myApp.use(SendCodeRouter)

myApp.use(express.static(`${__dirname}/public`));

myApp.listen(8888,function () {
    console.log('服务器启动')
})


